<!DOCTYPE html>
<html>
<head lang="en">
    <meta charset="UTF-8">
    <title>自定义对象</title>
    <script type="text/javascript">
        //对象的构造函数
        function Student(iName,iAddress,iGrade,iScore){
            this.name = iName;
            this.address = iAddress;
            this.grade = iGrade;
            this.score = iScore;
            this.information = showInformation;
        }

        //定义对象的方法
        function showInformation() {
            var msg = "";
            msg += "学生信息：\n";
            msg += "\n学生姓名："+this.name+"\n";
            msg += "家庭地址："+this.address+"\n";
            msg += "班级："+this.grade+"\n";
            this.score = 123;//改写score属性
            //delete this.score; 删除score属性
            msg += "分数："+this.score;

            window.alert(msg);

        }
        //生成对象的实例
        var ZJDX = new Student("单南虹", "湖北武汉", "6", "100");
    </script>
</head>
<body>
<form>
    <input type="button" value="查看" onclick="ZJDX.information()">
</form>
</body>
</html>